package com.tjetc.controller;

import com.tjetc.common.JsonResult;
import com.tjetc.entity.Refund;
import com.tjetc.service.RefundService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/refund")
public class RefundController {
    @Autowired
    private RefundService refundService;

    /***
     * 添加申请退款的记录
     * @param refund
     * @return
     */
    @RequestMapping("/add")
    public JsonResult add(@RequestBody Refund refund) {
        return refundService.add(refund);
    }

    /***
     * 删除申请退款的记录
     * @param id
     * @return
     */
    @RequestMapping("/delete")
    public JsonResult delete(int id) {
        return refundService.delete(id);
    }

    /***
     * 查询所有申请退款的记录
     * @return
     */
    @RequestMapping("/selectAll")
    public JsonResult selectAll() {
        return refundService.selectAll();
    }

    /***
     * 根据id查询申请退款的记录
     * @param id
     * @return
     */
    @RequestMapping("/selectById")
    public JsonResult selectById(int id) {
        return refundService.selectById(id);
    }
}
